package drds.common.db.xml_mapping.script.xml_tags;


public class VarDecl implements DynamicNode {

  private final String name;
  private final String expression;

  public VarDecl(String var, String exp) {
    name = var;
    expression = exp;
  }

  @Override
  public boolean apply(DynamicNodeContext dynamicNodeContext) {
    final Object value = OgnlCache.getValue(expression, dynamicNodeContext.getBindings());
    dynamicNodeContext.bind(name, value);
    return true;
  }

}
